package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtPaymentOrderMapper;
import com.ruoyi.business.domain.JtPaymentOrder;
import com.ruoyi.business.service.IJtPaymentOrderService;
import com.ruoyi.common.core.text.Convert;

import javax.validation.constraints.NotEmpty;

/**
 * 支付单Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-03-29
 */
@Service
public class JtPaymentOrderServiceImpl implements IJtPaymentOrderService 
{
    @Autowired
    private JtPaymentOrderMapper jtPaymentOrderMapper;

    /**
     * 查询支付单
     * 
     * @param paymentId 支付单主键
     * @return 支付单
     */
    @Override
    public JtPaymentOrder selectJtPaymentOrderByPaymentId(Long paymentId)
    {
        return jtPaymentOrderMapper.selectJtPaymentOrderByPaymentId(paymentId);
    }

    /**
     * 查询支付单
     *
     * @param paymentNo 支付单号
     * @return 支付单
     */
    @Override
    public JtPaymentOrder selectJtPaymentOrderByPaymentNo(String paymentNo){
        return jtPaymentOrderMapper.selectJtPaymentOrderByPaymentNo(paymentNo);
    }

    /**
     * 查询支付单列表
     * 
     * @param jtPaymentOrder 支付单
     * @return 支付单
     */
    @Override
    public List<JtPaymentOrder> selectJtPaymentOrderList(JtPaymentOrder jtPaymentOrder)
    {
        return jtPaymentOrderMapper.selectJtPaymentOrderList(jtPaymentOrder);
    }

    /**
     * 新增支付单
     * 
     * @param jtPaymentOrder 支付单
     * @return 结果
     */
    @Override
    public int insertJtPaymentOrder(JtPaymentOrder jtPaymentOrder)
    {
        jtPaymentOrder.setCreateTime(DateUtils.getNowDate());
        return jtPaymentOrderMapper.insertJtPaymentOrder(jtPaymentOrder);
    }

    /**
     * 修改支付单
     * 
     * @param jtPaymentOrder 支付单
     * @return 结果
     */
    @Override
    public int updateJtPaymentOrder(JtPaymentOrder jtPaymentOrder)
    {
        jtPaymentOrder.setUpdateTime(DateUtils.getNowDate());
        return jtPaymentOrderMapper.updateJtPaymentOrder(jtPaymentOrder);
    }

    /**
     * 批量删除支付单
     * 
     * @param paymentIds 需要删除的支付单主键
     * @return 结果
     */
    @Override
    public int deleteJtPaymentOrderByPaymentIds(String paymentIds)
    {
        return jtPaymentOrderMapper.deleteJtPaymentOrderByPaymentIds(Convert.toStrArray(paymentIds));
    }

    /**
     * 删除支付单信息
     * 
     * @param paymentId 支付单主键
     * @return 结果
     */
    @Override
    public int deleteJtPaymentOrderByPaymentId(Long paymentId)
    {
        return jtPaymentOrderMapper.deleteJtPaymentOrderByPaymentId(paymentId);
    }

    /**
     * 查询交易单号
     * @param tradeNo
     * @return
     */
    @Override
    public List<Long> selectJtPaymentOrderByTradeNo(String tradeNo){
        return jtPaymentOrderMapper.selectJtPaymentOrderByTradeNo(tradeNo);
    }
    /**
     * 统计支付 金额
     * @param startDate 开始时间
     * @param endDate 结束时间
     * @return
     */
    @Override
    public Double selectJtPaymentOrderAmount(@NotEmpty String startDate, @NotEmpty String endDate){
        return jtPaymentOrderMapper.selectJtPaymentOrderAmount(startDate, endDate);
    }

}
